package src.main.java.org.thread;

import java.util.concurrent.Callable;

public class MyCallable implements Callable<String> {
    private int n;

    public MyCallable(int n) {
        this.n = n;
    }
    @Override
    public String call() throws Exception {
        int sum = 0;
        //描述线程任务，返回线程执行完毕后的结果
        for (int i = 0; i <= n; i++) {
            sum += i;
        }
        return "1-n的和是："+sum;
    }
}
